{% extends "base.html" %}

{% block title %}pygame news{% endblock title -%}

{%- block feeds %}
    <link rel="alternate" type="application/atom+xml" title="pygame.org news (ATOM feed)" href="http://www.pygame.org/feed/news.php?format=ATOM"/>
    <link rel="alternate" type="application/rss+xml" title="pygame.org news (RSS 2.0 feed)" href="http://www.pygame.org/feed/news.php?format=RSS2.0" />
{%- endblock feeds %}


{% block content %}
  {% cache 60*5 %}
    <div class="row">
      <div class="col-sm-12">
        <h1>News
          <button type="button"
                  class="btn btn-primary pull-right"
                  data-toggle="modal"
                  data-target=".bs-example-modal-lg">New here?</button>
        </h1>
        {% if current_user.is_authenticated and current_user.has_role('admin') %}
          <a href="/news/new">Post news</a>
        {% endif %}
        <div>
        {% for new in news %}
          <div class="panel panel-default">
            <div class="panel-heading">
              <b>
                <a href="{{ url_for('news.view', slug=new.slug) }}">
                {{ new.title_html }} &mdash; {{ new.datetimeon.strftime('%-d %b, %Y') }}
                </a>
              </b>
            </div>
            <div class="panel-body dont-break-out">
              {{ new.description_html|safe }}
            </div>
          </div>
        {% endfor %}
        </div>
      </div>
    </div>
    {% include 'news/welcome.html' %}
  {% endcache %}
{% endblock %}